package com.frejoys.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.frejoys.common.dto.app.StoreWalletLogPageDto;
import com.frejoys.common.vo.app.StoreWalletLogPageVo;
import com.frejoys.dao.entity.StoreWalletLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

public interface StoreWalletLogMapper  extends BaseMapper<StoreWalletLog> {
    //后台分页查询店铺钱包信息
    Page<StoreWalletLogPageVo> selectPageWalletLog(Page<StoreWalletLogPageVo> page, @Param("dto") StoreWalletLogPageDto dto);

    // 更新提现状态
    @Update("update j_store_wallet_log set cash_money=cash_money-#{money},update_time=#{updateTime},status=#{newStatus} where id=#{id} and status=#{oldStatus}")
    boolean upCashStatus(@Param("id") Integer id, @Param("money") BigDecimal money, @Param("updateTime") Integer updateTime, @Param("oldStatus") Integer oldStatus, @Param("newStatus") Integer newStatus);

}
